<?php

	include_once("./global.php");
	session_start();
	if($_SESSION[id]){	
		$sql_select_app = "select A_Appid from appinfo";
		$query_select_app = $mysqli->query($sql_select_app);
		$total = $query_select_app->num_rows;
		$num = 25;
		$page = new Page($total,$num);
		


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<title>后台首页</title>
<style>
	body{ background:#e7e7e7; margin:0; padding:0;}
	#container{ width:980px; height:auto; position:relative; margin:0 auto;}
	#container #header{ width:980px; height:90px; position:relative; background:#000; line-height:90px;color:#fff; font-size:24px; text-align:center;}
	.left{width:250px; height:auto; position:relative; float:left;}
	.left table{width:248px; height:auto; position:relative; float:left; background:#fff;}
	.left table td{ height:20px; text-align:center;}
	.left table .selected{ background:#73abe3;}
	#content{ width:730px; height:100%; position:relative; float:left; margin:2px 0px;}
	#content .title{ width:720px; height:25px; position:relative; float:left; line-height:25px; font-size:18px; color:#fff; background:#000;}
	form{margin:20px auto; width:720px; height:auto; position:relative; float:left;}
	form .inpuarea{ width:360px; height:150px;}
	#content .app_class,#content .app_category{ width:100%; height:50px; position:relative; float:left; margin-top:3px;}
	#content .class_title,#content .category_title{ width:100%; height:15px; position:relative; float:left;}
	.app_class dt, .app_category dt{ width:auto; height:15px; position:relative; float:left; line-height:15px; font-size:14px; margin:0 3px;}
</style>
</head>
<body>
	<div id="container">
		<div id="header">
			818苹果站后台管理
		</div>
		<div class="left">
			<table>
				<tr><td style="background:#000000; color:#fff;">站点管理</td></tr>
				<tr><td><a href="admin_site_mangerment.php">全局管理</a></td></tr>
				<tr><td>静态页面管理</td></tr>
				<tr><td><a href="admin_link_mangerment.php?page=1">友情链接管理</a></td></tr>
				<tr><td><a href="admin_member_mangerment.php?page=1">会员管理</a></td></tr>
				<tr><td><a href="admin_tags_mangerment.php?page=1">标签管理</a></td></tr>
				<tr><td><a href="admin_search_mangerment.php">搜索管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">文章管理</td></tr>
				<tr><td><a href="admin_category_mangerment.php">文章分类管理</a></td></tr>
				<tr><td><a href="admin_news_add.php">发布文章</a></td></tr>
				<tr><td><a href="admin_news_mangerment.php?page=1">文章管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">应用管理</td></tr>
				<tr><td><a href="admin_appcate_mangerment.php">应用分类管理</a></td></tr>
				<tr><td><a href="admin_app_add.php">添加应用</a></td></tr>
				<tr><td class="selected"><a href="admin_app_mangerment.php?page=1">应用管理</a></td></tr>
                <tr><td><a href="admin_app_collection.php">应用采集</a></td></tr>
				<tr><td><a href="admin_app_collection_single.php">单应用采集</a></td></tr>
			</table>
		</div>
	<div id="content">
		<div class="title">APP管理</div>
		<div class="class_title">搜索</div>
		<div class="app_class">
		<form action="" method="post">
			<dt><label>搜索APP</label></dt>
			<dt><input type="text" name="app_name" placeholder="请输入要搜索的APP名称" /></dt>
			<dt><input type="submit" name="search_app" value="搜索" /></dt>
		</form>
		</div>
		<div class="class_title">平台</div>
		<div class="app_class">
		
			<dt><a href="admin_app_mangerment.php?page=1">全部</a></dt>
			<dt><a href="admin_app_judgment.php?page=1&ca=0">IOS</a></dt>
			<dt><a href="admin_app_judgment.php?page=1&ca=1">越狱</a></dt>
		</div>
		<div class="category_title">类别</div>
        <div class="app_category">
        	
            	<dt><a href="admin_app_mangerment.php?page=1">全部</a></dt>
            <?php
            	$sql_appcategory = "select * from appcategoryinfo";
				$query_appcategory = $mysqli->query($sql_appcategory);
				while($result_appcategory = $query_appcategory->fetch_assoc()){
					$cid = $result_appcategory['AC_Categoryid'];
					$cname = $result_appcategory['AC_Categoryname'];
			?>
						<dt><a href="admin_app_judgment.php?page=1&kw=<?php echo $cid;?>&ca=<?php echo $url_category?>"><?php echo $cname;?></a></dt>
			<?php
				}
			?>
        </div>
		<form name="form1" action="" method="post">
		<table id="all">
			<tr>会员列表</tr>
			<tr>
				<td>APP编号</td>
				<td>APP标题</td>
				<td>所属分类</td>
				<td>发布时间</td>
                <td>操作</td>
			<?php
		
				if(isset($_POST['search_app'])){
					if($_POST['app_name'] == ''){
						echo "<script>alert('请输入要搜索的APP名称')</script>";
					}else{
						$app_name = $_POST['app_name'];
						$sql_select_search = "select A_Appid,A_Apptrackid,A_Apptrackname,A_Categoryid,A_Appdate from appinfo where A_Apptrackname like '%$app_name%'";
						$query_select_search = $mysqli->query($sql_select_search);
						while($result_select_search = $query_select_search->fetch_assoc()){
			?>
						<tr>
							<td><?php echo $result_select_search['A_Appid'];?></td>
							<td><?php echo $result_select_search['A_Apptrackname'];?></td>
							<td><?php echo $result_select_search['A_Categoryid'];?></td>
							<td><?php echo $result_select_search['A_Appdate'];?></td>
							<td><a href="admin_app_edit.php?aid=<?php echo $result_select_search['A_Apptrackid']?>">编辑</a></td>
						</tr>
			<?php
						}
					}
				}
		
			?>	
		</form>
	</div>
</body>
<script>
/*	$(document).ready(function(){
		$(".app_category").find("dt a").click(function(){
			var data = $(this).attr("data-filter");
			$("table#all").hide();
			$.post("judgment.php?page=1",{data:data},function(data){$("table#condition").show().html(data);})
		});
	});*/
</script>
</html>
<?php
	}else{
		echo "<script>你想干嘛！登录先！！！</script>";
		echo "<meta http-equiv=\"refresh\" content=\"1; url='admin_login.php' />";
	}

?>